<?php

namespace app\common\model;

use think\Model;
class Banner extends Model
{
    public static function get_banner_list()
    {
        $where = "status = '1'";
        $field = "id,name,image,is_jump,circle_id,content";
        $order = "weigh DESC,add_time DESC";
        $list = self::where($where)->field($field)->order($order)->select();
        foreach ($list as &$value){
            if($value['is_jump'] == '2'){
                $circle_info = UserCircle::get($value['circle_id']);
                if(empty($circle_info)){
                    $value['is_jump'] = '1';
                }
            }
        }
        return $list;
    }

    public function getImageAttr($value)
    {
        if($value){
            return splicing_domain($value);
        }else{
            return "";
        }
    }
}
